export interface WebSocketMessage {
    type: string;
    data: any;
    timestamp?: number; // 可选：默认使用 Date.now()
}

export enum WebSocketStatus {
    CONNECTING = 0,
    OPEN = 1,
    CLOSING = 2,
    CLOSED = 3,
}

export interface WebSocketOptions {
    url: string;
    protocols: string | string[];
    autoReconnect: boolean; // 默认 true
    reconnectInterval: number; // 默认 3000 ms
    maxReconnectAttempts: number; // 默认 5 次
    heartbeatInterval: number; // 默认 30000 ms；不设置则不启用心跳
    heartbeatTimeout: number; // 默认 5000 ms；pong 超时判定
    reconnectBackoffFactor: number; // 默认 1.5；指数退避倍数
    sendBufferMaxSize: number; // 默认 100；发送队列上限
    resendOnReconnect: boolean; // 默认 true；重连后是否重发缓存
}